package com.cooper.favorite;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cooper.dao.favorite.FavoriteDAO;
import com.cooper.pagination.PageInfo;
import com.cooper.vo.DesignerVo;
import com.cooper.vo.ItemInfoVo;

@Service
public class FavoriteService {

    protected Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private FavoriteDAO  favoriteDAO;
	
	public int queryFavoriteItemInfoCount(Long userId){
		try {
			return favoriteDAO.queryFavoriteItemInfoCount(userId);
		} catch (Exception e) {
			logger.error("FavoriteService-queryFavoriteItemInfoCount-error", e);
		}
		return 0;
	}
	
	public int queryFavoriteDesignerCount(Long userId){
		try {
			return favoriteDAO.queryFavoriteDesignerCount(userId);
		} catch (Exception e) {
			logger.error("FavoriteService-queryFavoriteDesignerCount-error", e);
		}
		return 0;
	}
	
	public List<ItemInfoVo> queryFavoriteItemInfoList(Long userId, PageInfo pageInfo){
		try {
			return favoriteDAO.queryFavoriteItemInfoList(userId, pageInfo);
		} catch (Exception e) {
			logger.error("FavoriteService-queryFavoriteItemInfoList-error", e);
		}
		return null;
	}
	
	public List<DesignerVo> queryFavoriteShopList(Long userId,PageInfo pageInfo){
		try {
			return favoriteDAO.queryFavoriteShopList(userId, pageInfo);
		} catch (Exception e) {
			logger.error("FavoriteService-queryFavoriteShopList-error", e);
		}
		return null;
	}
}
